package com 
{
	import com.greensock.loading.display.ContentDisplay;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	/**
	 * ...
	 * @author ...
	 */
	public class FlaImage extends FlaObject
	{
		private var _imageData:BitmapData;
		private var _image:Bitmap;
		
		override public function get width():Number {
			return _image.width;
		}
		override public function set width(value:Number):void {
			_image.width = value;
		}
		
		override public function get height():Number {
			return _image.height;
		}
		override public function set height(value:Number):void {
			_image.height = value;
		}
		
		public function FlaImage(data:ContentDisplay = null) 
		{
			if (data) {
				clone(data);
			}
		}
		
		public function setRegistrationPoint(regx:Number, regy:Number):void {
			_image.x = -regx;
			_image.y = -regy;
		}
		
		public function clone(object:ContentDisplay):void {
			_imageData = new BitmapData(object.width, object.height, true, 0x000000);
			_imageData.draw(object);
			_image = new Bitmap(_imageData);
			addChild(_image);
		}
		
		public override function kill():void {
			super.kill();
			removeChild(_image);
			_imageData.dispose();
			_imageData = null;
			_image = null;
		}
	}

}